<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		 <meta name="renderer" content="webkit">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>部门管理</title>
	</head>
	<link rel="stylesheet" href="/Public/frame/layui/css/layui.css">
	<body>
		<button class="layui-btn" onclick="location.href='<?php echo U('lst');?>'" style="margin-top: 10px;"><i class="layui-icon">&#xe65c;</i></button>
        <a class="layui-btn btn-add btn-default" id="btn-refresh" style="margin-top: 10px;"><i class="layui-icon">&#x1002;</i></a>
        <fieldset class="layui-elem-field layui-field-title">
            <legend>添加部门</legend>
        </fieldset>
        <form class="layui-form layui-form-pane" action="/index.php/Hawk/Part/add.html" method="post">	
        	<div class="layui-form-item">
        		<label class="layui-form-label" title="请选择上级部门">上级部门</label>
        		<div class="layui-input-inline">
        			<select name="pid" lay-verify="required" lay-search="">
        				<option value="0">顶级部门</option>
        				<?php foreach ($list as $k => $v): ?>						
        					<option value="<?php echo $v['id']; ?>"><?php echo str_repeat('-', 8*$v['level']).$v['name']; ?></option>
        				<?php endforeach; ?>
        			</select>
        		</div>
        	</div>
        	<div class="layui-form-item">
        		<label class="layui-form-label">部门名称</label>
        		<div class="layui-input-inline">
        			<input type="text" name="name" lay-verify="required" placeholder="请输入部门名称" autocomplete="off" class="layui-input">
        		</div>
        	</div>
        	<div class="layui-form-item">
			    <div class="layui-input-block">
			      <button type="submit" class="layui-btn" lay-submit="" lay-filter="">立即提交</button>
			      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
			    </div>
			</div>
        </form>
    </body>
</html>
<script type="text/javascript" src="/Public/frame/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['layer','element','form'], function () {
        // 操作对象
        var layer = layui.layer ,element = layui.element,form = layui.form,$ = layui.jquery;
        $('#btn-refresh').on('click', function () {
            location.reload();
        });
    });
</script>